<template>
	<view>
		<view v-if="id == 2" class="">
			<scroll-view @scrolltolower="scrolltolower" scroll-y="true" style="height: 100vh">
				<view class="text" v-html="content"></view>
				<view class="btn_zw"></view>
				<view class="bottom_btns">
					<view class="cont">
						<view class="onebtns" :class="isAll?'active':'ac'" @click="goback">
							{{ isAll ? '确认' : '请向下滑动阅读' }}
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
		<view v-else  class="text" v-html="content"></view>
	</view>
</template>

<script setup>
import { ref, reactive, getCurrentInstance } from 'vue';
import { onLoad, onShow, onReachBottom, onPageScroll } from '@dcloudio/uni-app';
import { getProtocol } from '@/api/user.js';

const isAll = ref(false);
const scrolltolower = (e) => {
	isAll.value = true;
};
const goback = () => {
	if(isAll.value){
		uni.navigateBack();
		uni.$emit('isAll',true)
	}
};
const content = ref('');
const id = ref(0)
onLoad((option) => {
	id.value = option.id
	getProtocol({ id: option.id }).then((res) => {
		if (res.code == 200) {
			uni.setNavigationBarTitle({
				title: res.data.title
			});
			content.value = res.data.content;
		}
	});
});
</script>
<style lang="scss">
.text {
	padding: 30rpx 20rpx;
	font-size: 28rpx;
}
</style>
